#include "DefaultReadFormat.h"
#include <iostream>

#define NAME L"Default"

DefaultReadFormat::DefaultReadFormat()
{
	_name = wstring(NAME);
	_err = wstring(L"NONE");
}
DefaultReadFormat::~DefaultReadFormat()
{
}
bool DefaultReadFormat::Inited()
{
	return true;
}

void DefaultReadFormat::Close()
{
	delete this;
}

int DefaultReadFormat::Decode(unsigned char *dest, int dest_buf_len, unsigned char *source, int color_depth, int column, int line, DecodeRequestStruct* args/* = 0*/)
{
	memcpy(dest, source, dest_buf_len);
	return 0;
}

const wchar_t* DefaultReadFormat::Name()
{
	return _name.c_str();
}
const wchar_t* DefaultReadFormat::ErrorInfo()
{
	return _err.c_str();
}

void* GetDecoderPlugin(int version)
{
	if (version == DECODER_PLUGIN_INTERFACE_VERSION){
		return new DefaultReadFormat();
	} else{
		return NULL;
	}
}